package com.elastic.controller;

import com.elastic.service.StartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/stars")
public class StartsController {


    @Autowired
    private StartsService startsService;


    @GetMapping
    public Object autoComplete(String term){
        try {
            return startsService.autoComplete(term);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


}
